"""
静态文件服务相关的API路由
包括静态文件、JS文件、页面文件的服务
"""

from flask import Blueprint, send_from_directory

# 创建蓝图
static_bp = Blueprint('static_routes', __name__)

@static_bp.route('/')
def index():
    """主页"""
    return send_from_directory('static', 'index.html')

@static_bp.route('/static/<path:filename>')
def serve_static(filename):
    """提供静态文件服务"""
    return send_from_directory('static', filename)

@static_bp.route('/js/<path:filename>')
def serve_js(filename):
    """提供js目录下的静态文件服务"""
    return send_from_directory('static/js', filename)

@static_bp.route('/css/<path:filename>')
def serve_css(filename):
    """提供css目录下的静态文件服务"""
    return send_from_directory('static/css', filename)

@static_bp.route('/pages/<path:filename>')
def serve_pages(filename):
    """提供pages目录下的静态文件服务"""
    return send_from_directory('static/pages', filename)